﻿using ExpressionDemo.Entity;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace ExpressionDemo.Config
{
    public class PostConfig : IEntityTypeConfiguration<Post>
    {
        public void Configure(EntityTypeBuilder<Post> builder)
        {
            builder.ToTable("T_Post").HasKey(p=>p.PostId);
            builder.HasOne(p=>p.Blog).WithMany(p=>p.Posts).HasForeignKey(p=>p.BlogId);
        }
    }
}
